<template>
	<view class="page" :data-maoui-theme-mode="mao_theme">
		<mao-custom bgColor="bg-gradual-blue"><block slot="content">{{mao_title}}</block></mao-custom>
		<view class="text-center margin-top">
			Gitee地址：{{mao_gitee}}
		</view>
		<view class="btn-group text-center margin-top padding-top">
			<button 
			class="cu-btn bg-cyan" 
			v-for="(item,index) in mao_themes" 
			:key="'mao_themes'+index" 
			v-if="item.theme != mao_theme" 
			@click="$mao.applyTheme(item.theme)"
			>切换为{{item.name}}</button>
		</view>
		<view class="margin-top padding-top text-center">
			<navigator url="../pages/index/index">
				<button class="cu-btn bg-red">进入ColorUI演示</button>
			</navigator>
		</view>
		
		<view class="margin-top padding-top text-center">
			<button class="cu-btn bg-red" @click="$mao.route('/pages/index/index', {appid: 1})">跳转ColorUI演示</button>
		</view>
	</view>
</template>
<script>
	export default {
		data() {
			return {}
		},
		methods: {},
		onLoad() {
			/**
			 * API请求库示例
			this.$mao.http.get('banner', {qq:'27941662'}, {}, function(data){
				console.log(data, '请求成功');
			});
			 */
			
			/**
			 * 时间戳转换示例
			let timeStamp = 1617024111;
			console.log(timeStamp, '时间戳');
			console.log(this.$mao.timeFormat.fixed(timeStamp), '固定格式转换结果');
			console.log(this.$mao.timeFormat.before(timeStamp), '多久之前转换结果');
			 */
			
			/**
			 * 字符串和对象互转示例
			let object = {name:'张三', age: '18'};
			let string = this.$mao.objectToString(object);
			console.log(object, '原始对象');
			console.log(string, '转为字符串');
			console.log(this.$mao.stringToObject(string), '再转为对象');
			 */
			
			/**
			 * 去除String中空格示例
			let string = ' MaoUI 是基于ColorUI的非官方延伸扩展UI包 ';
			console.log(string, '原始字符串');
			console.log(this.$mao.trim(string), '默认去除两边空格');
			console.log(this.$mao.trim(string, 'lf'), '通过设置 去除两边空格');
			console.log(this.$mao.trim(string, 'left'), '通过设置 去除左边空格');
			console.log(this.$mao.trim(string, 'right'), '通过设置 去除右边空格');
			console.log(this.$mao.trim(string, 'all'), '通过设置 去除所有空格');
			 */
			
			/**
			 * 校验文本示例
			console.log(this.$mao.validate.code('1234', 4), '验证码校验结果');
			console.log(this.$mao.validate.array([123]), '校验是否为数组');
			console.log(this.$mao.validate.object({name: 'MaoUI'}), '校验是否为对象');
			console.log(this.$mao.validate.json("{\"code\":200}"), '校验是否为JSON字符串');
			console.log(this.$mao.validate.email("27941662@qq.com"), '校验是否为正确的邮箱地址');
			console.log(this.$mao.validate.phone("18588888888"), '校验手机号格式是否正确');
			console.log(this.$mao.validate.url(this.mao_gitee), '校验网址是否正确');
			console.log(this.$mao.validate.empty(), '判断是否为空');
			console.log(this.$mao.validate.integer(27941662), '校验是否为整数');
			console.log(this.$mao.validate.idcode('513723199705143212'), '校验身份证号是否正确');
			console.log(this.$mao.validate.carid('川A88888'), '校验车牌号是否正确');
			console.log(this.$mao.validate.price('0.88'), '校验金额是否正确');
			console.log(this.$mao.validate.chinese('你是谁'), '检验是否为中文');
			console.log(this.$mao.validate.letter('SCHOOP'), '检验是否为字母');
			console.log(this.$mao.validate.letterOrNumber('QQ27941662'), '检验是否为字母或数字');
			console.log(this.$mao.validate.indexof('27941662', '66'), '检测是否包含某个值');
			console.log(this.$mao.validate.numberRange(8, 5, 10), '检测数值是否在某个范围内');
			console.log(this.$mao.validate.stringLenghtRange('我是MaoUI', 5, 10), '检测文本长度是否在某个范围内');
			 */
			
			
			
			
		}
	}
</script>
